package com.dhh.activity;

import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import com.dhh.R;
import greendroid.app.GDActivity;

public class SelectTopicActivity extends GDActivity{
	@Override
    public void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
		initActionBar();
		
		String topic = this.getIntent().getStringExtra("food_group");		
		if(topic.equals("top_grain")){
			setActionBarContentView(R.layout.top_grain);
		}else if(topic.equals("top_fruit")){
			setActionBarContentView(R.layout.top_fruit);
		}else if(topic.equals("top_vegetable")){
			setActionBarContentView(R.layout.top_vegetable);
		}else if(topic.equals("top_protein")){
			setActionBarContentView(R.layout.top_protein);
		}else if(topic.equals("top_dairy")){
			setActionBarContentView(R.layout.top_dairy);
		}else if(topic.equals("activity_level")){
			setActionBarContentView(R.layout.help_activity_level);
		}
	}
	
	private void initActionBar(){
		getActionBar().setTitle("Topics");
        getActionBar().setBackgroundColor(Color.rgb(82, 135, 241));
        getActionBar().getChildAt(0).
    	setOnClickListener(new OnClickListener(){
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(SelectTopicActivity.this,HomeActivity.class);	
				startActivity(intent);
			}}); 
	}
	
	public void myClick(View v) {
		Intent intent = new Intent(this,ShowTopicActivity.class);
		if(v.getId() == R.id.top_grain_1){
			intent.putExtra("topic", "top_grain_1");
		}else if(v.getId() == R.id.top_grain_2){
			intent.putExtra("topic", "top_grain_2");
		}else if(v.getId() == R.id.top_grain_3){
			intent.putExtra("topic", "top_grain_3");
		}else if(v.getId() == R.id.top_grain_4){
			intent.putExtra("topic", "top_grain_4");
		}else if(v.getId() == R.id.top_grain_5){
			intent.putExtra("topic", "top_grain_5");
		}else if(v.getId() == R.id.top_fruit_1){
			intent.putExtra("topic", "top_fruit_1");
		}else if(v.getId() == R.id.top_fruit_2){
			intent.putExtra("topic", "top_fruit_2");
		}else if(v.getId() == R.id.top_fruit_3){
			intent.putExtra("topic", "top_fruit_3");
		}else if(v.getId() == R.id.top_fruit_4){
			intent.putExtra("topic", "top_fruit_4");
		}else if(v.getId() == R.id.top_fruit_5){
			intent.putExtra("topic", "top_fruit_5");
		}else if(v.getId() == R.id.top_vegetable_1){
			intent.putExtra("topic", "top_vegetable_1");
		}else if(v.getId() == R.id.top_vegetable_2){
			intent.putExtra("topic", "top_vegetable_2");
		}else if(v.getId() == R.id.top_vegetable_3){
			intent.putExtra("topic", "top_vegetable_3");
		}else if(v.getId() == R.id.top_vegetable_4){
			intent.putExtra("topic", "top_vegetable_4");
		}else if(v.getId() == R.id.top_vegetable_5){
			intent.putExtra("topic", "top_vegetable_5");
		}else if(v.getId() == R.id.top_vegetable_6){
			intent.putExtra("topic", "top_vegetable_6");
		}else if(v.getId() == R.id.top_protein_1){
			intent.putExtra("topic", "top_protein_1");
		}else if(v.getId() == R.id.top_protein_2){
			intent.putExtra("topic", "top_protein_2");
		}else if(v.getId() == R.id.top_protein_3){
			intent.putExtra("topic", "top_protein_3");
		}else if(v.getId() == R.id.top_protein_4){
			intent.putExtra("topic", "top_protein_4");
		}else if(v.getId() == R.id.top_protein_5){
			intent.putExtra("topic", "top_protein_5");
		}else if(v.getId() == R.id.top_protein_6){
			intent.putExtra("topic", "top_protein_6");
		}else if(v.getId() == R.id.top_dairy_1){
			intent.putExtra("topic", "top_dairy_1");
		}else if(v.getId() == R.id.top_dairy_2){
			intent.putExtra("topic", "top_dairy_2");
		}else if(v.getId() == R.id.top_dairy_3){
			intent.putExtra("topic", "top_dairy_3");
		}else if(v.getId() == R.id.top_dairy_4){
			intent.putExtra("topic", "top_dairy_4");
		}else if(v.getId() == R.id.top_dairy_5){
			intent.putExtra("topic", "top_dairy_5");
		}
		
		this.startActivity(intent);
	}
}
